package com.sky.controller.admin;

import com.sky.entity.OrderDetail;
import com.sky.result.Result;
import com.sky.service.OrderDetailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author 褚金龙
 * @Date 2024/10/11 22:19
 */

@RestController("adminOrderDetailController")
@RequestMapping("/admin")
@CrossOrigin("*")
@Api(tags = "管理端订单相关接口")
@Slf4j
public class OrderDetailController {
    @Autowired
    private OrderDetailService orderDetailService;
    @GetMapping("/orderDetail/list/{id}")
    @ApiOperation("按订单id进行详情查询")
    public Result<List<OrderDetail>> selectOrderDetail(@PathVariable Integer id){

        List<OrderDetail> list = orderDetailService.select(id);
        return Result.success(list);
    }

    @PostMapping("/orderDetail/all")
    @ApiOperation("批量查询订单详情")
    public Result<List<OrderDetail>> selectAllOrderDetail(@RequestBody List<Long> ids){
        log.info("ids{}",ids);
        List<OrderDetail> list = orderDetailService.selectAll(ids);
        return Result.success(list);
    }

}
